package com.baidu.controller;

import com.baidu.service.TbGoodsAuditService;
import com.baidu.utils.ResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 宋金航
 * 商品审核控制层
 */
@RestController
@RequestMapping("goodsAudit")
@CrossOrigin
public class GoodsAuditController {

    @Autowired
    private TbGoodsAuditService tbGoodsAuditService;

    /**
     * 分页模糊查询  商品审核查询
     * @param page
     * @param size
     * @param name
     * @return
     */
    @GetMapping("findList/{page}/{size}")
    public ResultResponse findList(@PathVariable("page")Integer page,
                                   @PathVariable("size")Integer size,
                                   String name){
        //直接调业务层
        return this.tbGoodsAuditService.findList(page,size,name);
    }

    /**
     * 批量删除
     * @param ids
     * @return
     */
    @DeleteMapping("deleteIds/{ids}")
    public ResultResponse deleteIds(@PathVariable("ids")Long[] ids){
        return this.tbGoodsAuditService.deleteIds(ids);
    }

    /**
     * 根据ID查询
     * @param id
     * @return
     */
    @GetMapping("findById/{id}")
    public ResultResponse findById(@PathVariable("id")Long id){
        return this.tbGoodsAuditService.findById(id);
    }

    /**
     * 拒绝审核
     * @param ids
     * @return
     */
    @PostMapping("auditReject/{ids}")
    public ResultResponse auditReject(@PathVariable("ids") Long[] ids){
        return this.tbGoodsAuditService.auditReject(ids);
    }

    /**
     * 审核通过
     * @param ids
     * @return
     */
    @PostMapping("auditPass/{ids}")
    public ResultResponse auditPass(@PathVariable("ids") Long[] ids){
        return this.tbGoodsAuditService.auditPass(ids);
    }
}
